<template>
        <!-- 绑定维修类别弹窗 -->
        <el-dialog title="选择资产类别"  :visible.sync="dialogIsShow" width="480px" center class="zdy-dialog">
            <div class="sel-tree">
                <el-tree 
                    ref="mytree"
                    :data="menuItems"
                    show-checkbox 
                    node-key="id" 
                    :default-expand-all="true"
                    :default-checked-keys="checkedKeys" 
                    :props="defaultProps">
                </el-tree>
                    <!-- check-strictly -->
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogIsShow = false" class="zdy-btn" onFocus="this.blur()">取 消</el-button>
                <el-button type="primary" @click="bindAsstesType" :disabled="isdisable"  class="zdy-btn zdy-alert-btn" onFocus="this.blur()">确 定</el-button>
            </span>
        </el-dialog>
</template>

<script>
/* eslint-disable */  
import {getCategoriesApi } from "@/api" 
export default {
    name:"treeModel",
    props:[ 'checkedKeys', 'wh_id',],
    data(){
        // var isSon = function(data,node){
        //     return data.pid==0
        // }
        return {
            dialogIsShow:false,
            isdisable:false,
            /**类别列表 */
            menuItems:[],
            /**默认字段名称 */
            defaultProps: {
                children: 'cate',
                label: 'category_name',
                // disabled:isSon
            },
        }
    },
    created(){
        this.getdata()
    },
    methods:{
        getdata(){
             getCategoriesApi({wh_id:this.$store.state.warehouseOfAssetsManager,category_type:2}).then(res=>{
                this.menuItems = res
            })
        },
        /**维修部门绑定资产类别 */
        bindAsstesType(){
            this.$emit('bindAsstesType',this.$refs.mytree.getCheckedKeys(),this.$refs.mytree.getCheckedNodes())
        },
    },
}
</script>

<style lang='stylus' >
</style>
